import { cateList } from '../../../request/api'

interface StateCate {
    catelist: Array<object>
}

const state = {
    catelist: []
}

const getters = {
    getCate(state: StateCate) {
        return state.catelist
    }
}

const mutations = {
    REQ_CATELIST(state: StateCate, payload: any) {
        state.catelist = payload
    }
}

const actions = {
    getCateListActions(context: any) {
        cateList({
            istree: 1
        }).then(res => {
            if (res.code == 200) {
                console.log(res, '商品分类行动');
                context.commit('REQ_CATELIST', res.list)
            }
        })
    }
}

export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}

